package com.ta.gulimall.coupon.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.ta.gulimall.common.view.to.SkuFullReductionTo;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ta.gulimall.coupon.dao.SkuLadderDao;
import com.ta.gulimall.coupon.entity.SkuLadderEntity;
import com.ta.gulimall.coupon.service.SkuLadderService;


@Service("skuLadderService")
public class SkuLadderServiceImpl extends ServiceImpl<SkuLadderDao, SkuLadderEntity> implements SkuLadderService {

    @Override
    public void saveSkuLadder(SkuFullReductionTo skuFullReductionTo) {
        if(skuFullReductionTo.getFullCount() > 0) {
            SkuLadderEntity skuLadderEntity = BeanUtil.copyProperties(skuFullReductionTo, SkuLadderEntity.class);
            skuLadderEntity.setAddOther(skuFullReductionTo.getCountStatus());

            this.save(skuLadderEntity);
        }
    }

}